<template>
	<view class="template">
		<view class="flex justify-between b_card" @click="jumpUrl">
			<view class="b_title">
				<text :class="'cuIcon-'+icon" v-if="icon" class="tIcon"></text>
				<text>{{title}}</text>
			</view>
			<view class="b_more">
				<text style="margin-right: 5rpx;">详情</text>
				<text class="cuIcon-right"></text>
			</view>
		</view>
	</view>
</template>

<script>
	const app = getApp();

	export default {
		name: 'text-bar',
		data() {
			return {}
		},
		props: {
			title: {
				type: String,
				default: ''
			},
			pageUrl: {
				type: String,
				default: ''
			},
			icon: {
				type: [String || null],
				default: ''
			},
			gType: {
				type: [String || null],
				default: ''
			}
		},
		methods: {
			jumpUrl() {
				if (this.pageUrl) {
					if (this.pageUrl == '1') {
						uni.showModal({
							title: '提示',
							content: '功能暂未开通，敬请期待',
							showCancel: false,
							success(res) {}
						});
					} else {
						if(this.gType == 'yc') {
							uni.navigateTo({
								url: this.pageUrl
							})
						} else {
							app.checkLogin('center').then(res => {
								uni.navigateTo({
									url: this.pageUrl
								})
							})
						}						
					}
				}
			}
		}
	}
</script>

<style scoped>
	.b_card {
		background-color: #fff;
		margin: 20rpx 20rpx;
		padding: 30rpx 20rpx;
		border-radius: 15rpx;
	}

	.b_title {
		color: #333;
		font-weight: bold;
		font-size: 30rpx;
	}

	.b_more {
		color: #B3BAC5;
		font-size: 22rpx;
	}

	.tIcon {
		font-size: 34rpx;
		color: #919191;
		margin-right: 5rpx;
	}
</style>